package model

import (
	"manager/model/entity"
)

// VehicleSkillCreateRequest 创建现场数据
type VehicleSkillCreateRequest struct {
	EbikeTypeId int64 `json:"ebike_type_id"`

	EbikeTypeName string `json:"ebike_type_name"`

	Kind int `json:"kind"`

	Title string `json:"title"`

	Content string `json:"content"`

	Country string `json:"country"`

	Language string `json:"language"`

	Url string `json:"url"`

	HeadImg string `json:"head_img"`

	NickName string `json:"nick_name"`

	KnowledgeTypeName string `json:"knowledge_type_name"`

	UpdatedAt int64 `json:"updated_at"`
}

// VehicleSkillUpdateRequest 更新现场数据
type VehicleSkillUpdateRequest struct {
	Id int64 `json:"id"`

	EbikeTypeId *int64 `json:"ebike_type_id"`

	EbikeTypeName *string `json:"ebike_type_name"`

	Kind *int `json:"kind"`

	Title *string `json:"title"`

	Content *string `json:"content"`

	Country *string `json:"country"`

	Language *string `json:"language"`

	Url *string `json:"url"`

	HeadImg *string `json:"head_img"`

	NickName *string `json:"nick_name"`

	KnowledgeTypeName *string `json:"knowledge_type_name"`

	CreatedAt int64 `json:"created_at"`

	UpdatedAt *int64 `json:"updated_at"`
}

// VehicleSkillListRequest 列表现场数据
type VehicleSkillListRequest struct {
	Index int `json:"index"`
	Size  int `json:"size"`

	Id int64 `json:"id"`

	EbikeTypeId *int64 `json:"ebike_type_id"`

	EbikeTypeName *string `json:"ebike_type_name"`

	Kind *int `json:"kind"`

	Title *string `json:"title"`

	Content *string `json:"content"`

	Country *string `json:"country"`

	Language *string `json:"language"`

	Url *string `json:"url"`

	HeadImg *string `json:"head_img"`

	NickName *string `json:"nick_name"`

	KnowledgeTypeName *string `json:"knowledge_type_name"`

	UpdatedAt *int64 `json:"updated_at"`
}

// VehicleSkillListResponse 列表回包数据
type VehicleSkillListResponse struct {
	Total int                 `json:"total"`
	List  []*VehicleSkillInfo `json:"list"`
}

// VehicleSkillInfoRequest 列表现场数据
type VehicleSkillInfoRequest struct {
	Id int64 `json:"id"`

	EbikeTypeId *int64 `json:"ebike_type_id"`

	EbikeTypeName *string `json:"ebike_type_name"`

	Kind *int `json:"kind"`

	Title *string `json:"title"`

	Content *string `json:"content"`

	Country *string `json:"country"`

	Language *string `json:"language"`

	Url *string `json:"url"`

	HeadImg *string `json:"head_img"`

	NickName *string `json:"nick_name"`

	KnowledgeTypeName *string `json:"knowledge_type_name"`

	UpdatedAt *int64 `json:"updated_at"`
}

// VehicleSkillInfo 详细数据
type VehicleSkillInfo struct {
	Id int64 `json:"id"`

	EbikeTypeId int64 `json:"ebike_type_id"`

	EbikeTypeName string `json:"ebike_type_name"`

	Kind int `json:"kind"`

	Title string `json:"title"`

	Content string `json:"content"`

	Country string `json:"country"`

	Language string `json:"language"`

	Url string `json:"url"`

	HeadImg string `json:"head_img"`

	NickName string `json:"nick_name"`

	KnowledgeTypeName string `json:"knowledge_type_name"`

	CreatedAt int64 `json:"created_at"`

	UpdatedAt int64 `json:"updated_at"`
}

// VehicleSkillDeleteRequest 删除现场数据
type VehicleSkillDeleteRequest struct {
	Id int64 `json:"id"`
}

// VehicleSkillsEntityToDto entity数据转换
func VehicleSkillsEntityToDto(vehicleSkills []*entity.VehicleSkill) []*VehicleSkillInfo {
	out := make([]*VehicleSkillInfo, 0, len(vehicleSkills))
	for _, c := range vehicleSkills {
		out = append(out, VehicleSkillEntityToDto(c))
	}
	return out
}

// VehicleSkillEntityToDto entity数据转换
func VehicleSkillEntityToDto(e *entity.VehicleSkill) *VehicleSkillInfo {
	return &VehicleSkillInfo{

		Id: e.Id,

		EbikeTypeId: e.EbikeTypeId,

		EbikeTypeName: e.EbikeTypeName,

		Kind: e.Kind,

		Title: e.Title,

		Content: e.Content,

		Country: e.Country,

		Language: e.Language,

		Url: e.Url,

		HeadImg: e.HeadImg,

		NickName: e.NickName,

		KnowledgeTypeName: e.KnowledgeTypeName,

		CreatedAt: e.CreatedAt,

		UpdatedAt: e.UpdatedAt,
	}
}
